package wallpaperchanger

import org.codehaus.groovy.scriptom.ActiveXProxy

class Changer {
	private static String script = '''
		Sub ChangeWallpaper (WallpaperPath)
		Set oShell = CreateObject("WScript.Shell")
		oShell.RegWrite "HKCU\\Control Panel\\Desktop\\Wallpaper", WallpaperPath
		oShell.Run  "%windir%\\System32\\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True
		End Sub	
	'''

	def static changeWallpaper(filePath) {
		def sc = new ActiveXProxy("ScriptControl")
		sc.Language = "VBScript"
		sc.AllowUI = 1
		sc.AddCode(script)
		sc.Run('ChangeWallpaper', filePath)
	}
}

class WallpaperConfig {
	List categories
	String wallpaperSize
	
	def load() {
		
	}
	
	def save() {
		
	}
}


